package cn.yunhe.dplayerdemo3.mapper;

import cn.yunhe.dplayerdemo3.entity.Coin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface ICoinMapper extends BaseMapper<Coin> {

    /**
     * 投币
     * @param coin
     * @return
     */
    @Insert("insert into tb_coin(id,uid) values(#{video.id},#{userInfo.uid})")
    int addCoin(Coin coin);

    @Select("select * from tb_coin where uid=#{userInfo.uid} and id = #{video.id}")
    Coin getCoin(Coin coin);
}
